<?php

import("data.db.DbAbstractTable");
import("data.db.DbFactory");

class DbProducer extends DbAbstractTable {
	
	var $className = "data.logic.producer.Producer";
	const CLASS_NAME =  "data.logic.producer.Producer";
	
	//
	// SQL Table description section
	//
	const TB_TABLENAME	= "pd_producer";
	const TB_I			= 'prdcr';
	
	const TB_NAME		= 'prdcr_name';
	
	function _get_TABLENAME() {return self::TB_TABLENAME;}
	function _get_ID() {return self::TB_I."_id";}
	function _get_SUFFIX() {return self::TB_I;}
	//
	//
	
	// properties
	var $name;
	
	public function __construct($noinit=false) {
		parent::__construct($noinit);
	}
	
	function getName() {
		return $this->name;
	}
	function setName($name) {
		$this->name = $name;
	}
	
	// restore
	function fillEntity($arrResult) {
		parent::fillEntity($arrResult);
		$this->setName($arrResult[self::TB_NAME]);
	}
	
	//store
	function fillFields() {
		parent::fillFields();
		$this->fildsForStore[self::TB_NAME] = "'".$this->getName()."'";
	}
	
	// same for all classes
	public static function findAll() {return parent::findAll(self::CLASS_NAME);}
    public static function findById($id) {return parent::findById($id, self::CLASS_NAME);}

}
?>